function Justify(standard_id, change_id)
{
    var text = document.getElementById(standard_id);
    var subtext = document.getElementById(change_id);

    var CreateTestObject =
    function(orig, new_id)
    {
        var test = orig.cloneNode(true);
        test.style.position = 'absolute';
        test.style.top = '0';
        test.style.left = '0';
        test.style.width = 'auto';
        test.style.visiblity = 'hidden';
        test.style.opacity = 0;
        test.style.filter = 'alpha(opacity=0)';
        test.style.textAlign = 'left';
        orig.parentNode.appendChild(test);
        test.id = new_id;

        return test;
    }

    // create test object. it hidden
    var test_text = CreateTestObject(text, 'justify_test1');
    var test_subtext = CreateTestObject(subtext, 'justify_test2');

    // get text width
    var text_width = test_text.offsetWidth + 1;
    var subtext_width;
    var i;

    // Remember subtext height
    var start_height = test_subtext.offsetHeight;

    // find subtext width (changing letter-spacing)
    for(i=0; i<32; i++)
    {
        test_subtext.style.letterSpacing = i + 'px';
        subtext_width = test_subtext.offsetWidth;
        // fix for chrome. - i
        if (!document.all)
            subtext_width = subtext_width - i;
/*
*/
        // break when over wide (or word wrap) and get previous spacing value
        if (subtext_width > text_width ||
            start_height != test_subtext.offsetHeight)
        {
            if (i > 0)
            {
                i--;
            }
            test_subtext.style.letterSpacing = i + 'px';
            break;
        }
    }

    // set letter spacing
    subtext.style.letterSpacing = i + 'px';

    // find subtext width (changing word-spacing)
    for(i=0; i<32; i++)
    {
        test_subtext.style.wordSpacing = i + 'px';
        subtext_width = test_subtext.offsetWidth;

        // break when over wide and get previous spacing value
        if (subtext_width > text_width ||
            start_height != test_subtext.offsetHeight)
        {
            if (i > 0)
            {
                i--;
            }
            break;
        }
    }

    // set word spacing
    subtext.style.wordSpacing = i+'px';

    text.parentNode.removeChild(test_text);
    subtext.parentNode.removeChild(test_subtext);

    subtext.style.textAlign = 'justify';
}
